<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<t:link />
<title>登录</title>
</head>

<style>
.dev {
	height: 100%;
	margin: 50px 0 0 25px;
	overflow-x: hidden; /*隐藏水平滚动条*/
	overflow-y: hidden;
	*/ /*隐藏垂直滚动条*/
}
</style>

<body>
	<div class="row">
		<div class="col-lg-12 col-sm-12 col-xs-12">
			<div class="widget  dev">
				<div class="widget-header bordered-bottom bordered-blue">
					<span class="widget-caption">新增用户信息</span>
				</div>
				<div class="widget-body">
					<div id="horizontal-form">
						<form class="form-horizontal" role="form" action="" method="post">
							<input type="hidden" id="id" name="id">
							<div class="form-group">
								<label for="username"
									class="col-sm-2 control-label no-padding-right">用户名</label>
								<div class="col-sm-6">
									<input class="form-control" id="username" placeholder=""
										name="username" type="text">
								</div>
								<p class="help-block col-sm-4 red">* 必填</p>
							</div>
							<div class="form-group">
								<label for="password"
									class="col-sm-2 control-label no-padding-right">用户密码</label>
								<div class="col-sm-6">
									<input class="form-control" id="password" placeholder=""
										name="password" type="text" />
								</div>
								<p class="help-block col-sm-4 red">* 留空则表示不修改密码</p>
							</div>
							<div class="form-group">
								<label for="image"
									class="col-sm-2 control-label no-padding-right">头像</label>
								<div class="col-sm-6">
									<input class="form-control" id="image" placeholder=""
										name="image" type="file">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<label for="usercode"
									class="col-sm-2 control-label no-padding-right">昵称</label>
								<div class="col-sm-6">
									<input class="form-control" id="usercode" placeholder=""
										name="usercode" type="text">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<label for="email"
									class="col-sm-2 control-label no-padding-right">邮箱</label>
								<div class="col-sm-6">
									<input class="form-control" id="email" placeholder=""
										name="email" type="text">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<label for="phone"
									class="col-sm-2 control-label no-padding-right">联系电话</label>
								<div class="col-sm-6">
									<input class="form-control" id="phone" placeholder=""
										name="phone" type="text">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<label for="qq"
									class="col-sm-2 control-label no-padding-right">QQ</label>
								<div class="col-sm-6">
									<input class="form-control" id="qq" placeholder=""
										name="qq" type="text">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<label for="weixin"
									class="col-sm-2 control-label no-padding-right">微信</label>
								<div class="col-sm-6">
									<input class="form-control" id="weixin" placeholder=""
										name="weixin" type="text">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<label for="memo"
									class="col-sm-2 control-label no-padding-right">个人简介</label>
								<div class="col-sm-6">
									<input class="form-control" id="memo" placeholder=""
										name="memo" type="text">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>

							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<button id="button" type="button" class="btn btn-default">保存信息</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>


</body>


<script>
	$("#button").click(function() {
		var user = new Object();
		user.id=0;
		user.username=$("#username").val(),
		user.password=$("#password").val(),
		user.usercode=$("#usercode").val(),
		user.image=$("#image").val(),
		user.email=$("#email").val(),
		user.qq=$("#qq").val(),
		user.weixin=$("#weixin").val(),
		user.memo=$("#memo").val()
		$.ajax({
			url : "${pageContext.request.contextPath}/blogadmin/usersave",
			type : "POST",
			data : {
				user:JSON.stringify(user)
			},
			success : function(data) {
				alert("保存成功!");
				window.open(
						"${pageContext.request.contextPath}/blogadmin/user","_self");
			},
			error : function(data) {
				alert("保存失败!");
			}
		})

	})
</script>

</html>